package usgs.bip.swap.ctl;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import usgs.bip.swap.view.DownloadHelper;

@SuppressWarnings("serial")
public class DownloadServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		
		RequestDispatcher disp;
		String qaqcFileNamePrefix = getServletConfig().getInitParameter("qaqcFileBaseURL");
		String originalFileNamePrefix = getServletConfig().getInitParameter("originalFileBaseURL");
		String documentationSource = getServletConfig().getInitParameter("documentationSource");
		
		DownloadHelper downloadHelper = new DownloadHelper(originalFileNamePrefix, qaqcFileNamePrefix, documentationSource);
		req.setAttribute("downloadHelper", downloadHelper);
		disp = getServletContext().getRequestDispatcher("/view/download.jsp");
		
		
		
		try {
			disp.forward(req, resp);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		 

	}
}
